package com.nf.health.app.activity.my.bean;

import com.google.gson.annotations.SerializedName;
import com.nf.health.app.models.BaseModel;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * Created by Administrator on 2017/3/29/029.
 */

public class MyHealthyTestCompeteModel implements BaseModel {
    /**
     * flag : 1
     * answer : {"2":"D.食物多样,C.三餐有度","3":"B.错","4":"B.6","8":"A.对","11":"B.适量运动"}
     * list : [{"answer":"A.谷蔬为主,B.低盐少油,C.三餐有度,D.食物多样,E.戒烟限酒","correct":"A.谷蔬为主,B.低盐少油,C.三餐有度,D.食物多样","detail":"","id":2,"title":"合理膳食包括（多选）:","type":"2"},{"answer":"A.对,B.错","correct":"A.对","detail":"","id":3,"title":"谷蔬为主指主食以五谷为主，粗细合理搭配。每天吃一斤蔬菜水果。主食与副食合理搭配。","type":"1"},{"answer":"A.3,B.6,C.10,D.15","correct":"B.6","detail":"","id":4,"title":"低盐少油提倡每人每天食盐不超过____g(一啤酒瓶盖)","type":"1"},{"answer":"A.对,B.错","correct":"A.对","detail":"","id":8,"title":"吸烟者易有患各种癌症，心脑血管，呼吸系统疾病等。","type":"1"},{"answer":"A.合理膳食,B.适量运动,C.戒烟限酒,D.心理平衡,E.规律作息","correct":"E.规律作息","detail":"","id":11,"title":"提倡定点儿作息和早睡早起，保证每天充足睡眠(中老年人每天至少7小时)。提倡午休，切忌熬夜。属于下列哪项:","type":"1"}]
     */

    private String flag;
    private AnswerBean answer;
    private List<ListBean> list;

    public String getFlag() {
        return flag;
    }

    public void setFlag(String flag) {
        this.flag = flag;
    }

    public AnswerBean getAnswer() {
        return answer;
    }

    public void setAnswer(AnswerBean answer) {
        this.answer = answer;
    }

    public List<ListBean> getList() {
        return list;
    }

    public void setList(List<ListBean> list) {
        this.list = list;
    }

    public static class AnswerBean {
        /**
         * 2 : D.食物多样,C.三餐有度
         * 3 : B.错
         * 4 : B.6
         * 8 : A.对
         * 11 : B.适量运动
         */

        @SerializedName("2")
        private String value2;
        @SerializedName("3")
        private String value3;
        @SerializedName("4")
        private String value4;
        @SerializedName("8")
        private String value8;
        @SerializedName("11")
        private String value11;

        public String getValue2() {
            return value2;
        }

        public void setValue2(String value2) {
            this.value2 = value2;
        }

        public String getValue3() {
            return value3;
        }

        public void setValue3(String value3) {
            this.value3 = value3;
        }

        public String getValue4() {
            return value4;
        }

        public void setValue4(String value4) {
            this.value4 = value4;
        }

        public String getValue8() {
            return value8;
        }

        public void setValue8(String value8) {
            this.value8 = value8;
        }

        public String getValue11() {
            return value11;
        }

        public void setValue11(String value11) {
            this.value11 = value11;
        }
    }

    public static class ListBean {
        /**
         * answer : A.谷蔬为主,B.低盐少油,C.三餐有度,D.食物多样,E.戒烟限酒
         * correct : A.谷蔬为主,B.低盐少油,C.三餐有度,D.食物多样
         * detail :
         * id : 2
         * title : 合理膳食包括（多选）:
         * type : 2
         */

        private String answer;
        private String correct;
        private String detail;
        private int id;
        private String title;
        private String type;
        private Map<Integer, String> hashMap;
        private String select;

        public String getSelect() {
            return select;
        }

        public void setSelect(String select) {
            this.select = select;
        }

        public Map<Integer, String> getHashMap() {
            return hashMap;
        }

        public void setHashMap(Map<Integer, String> hashMap) {
            this.hashMap = hashMap;
        }

        public String getAnswer() {
            return answer;
        }

        public void setAnswer(String answer) {
            this.answer = answer;
        }

        public String getCorrect() {
            return correct;
        }

        public void setCorrect(String correct) {
            this.correct = correct;
        }

        public String getDetail() {
            return detail;
        }

        public void setDetail(String detail) {
            this.detail = detail;
        }

        public int getId() {
            return id;
        }

        public void setId(int id) {
            this.id = id;
        }

        public String getTitle() {
            return title;
        }

        public void setTitle(String title) {
            this.title = title;
        }

        public String getType() {
            return type;
        }

        public void setType(String type) {
            this.type = type;
        }
    }

    /**
     * flag : 0
     * list : [{"answer":"优,良,差","correct":"优","detail":"","id":1,"title":"善于休息，睡眠良好。"},{"answer":"优,良,差","correct":"优","detail":"","id":2,"title":"头发有光泽，无头屑。"},{"answer":"优,良,差","correct":"优","detail":"","id":3,"title":"肌肉丰满，皮肤有弹性。"},{"answer":"优,良,差","correct":"优","detail":"","id":4,"title":"睡眠基本正常"},{"answer":"优,良,差","correct":"优","detail":"","id":6,"title":"注意力，记忆力，思考能力基本正常"}]
     */

//    private String flag;
//    private List<ListBean> list;
//
//
    public List<ListBean>    parse2(List<ListBean>  list) {
        List<ListBean> result = new ArrayList<>();
        if(list == null){
            return  result;
        }
        for (int i = 0; i < list.size(); i++) {
            ListBean listBean= list.get(i);
            String answer =listBean.getAnswer();
            Map<Integer, String> hashMap = new HashMap<>();
            try {
                String [] answerArray = answer.split(",");
                for (int j = 0; j < answerArray.length; j++) {
                    hashMap.put(j,answerArray[j]);
                }
            }catch (Exception e){
                e.printStackTrace();
            }
            listBean.setHashMap(hashMap);
            result.add(listBean);
        }
        return result;
    }
//
//    public String getFlag() {
//        return flag;
//    }
//
//    public void setFlag(String flag) {
//        this.flag = flag;
//    }
//
//    public List<ListBean> getList() {
//        return list;
//    }
//
//    public void setList(List<ListBean> list) {
//        this.list = list;
//    }
//
    @Override
    public void parse(String jsonString) {

    }
//
//    public static class ListBean {
//        /**
//         * answer : 优,良,差
//         * correct : 优
//         * detail :
//         * id : 1
//         * title : 善于休息，睡眠良好。
//         */
//
//        private String answer;
//        private String correct;
//        private String detail;
//        private int id;
//        private String title;
//        String type = "";
//        private String select;
//
//        public String getType() {
//
//            return type;
//        }
//
//        public void setType(String type) {
//            this.type = type;
//        }
//
//        private Map<Integer, String> hashMap;
//
//        public String getSelect() {
//            return select;
//        }
//
//        public void setSelect(String select) {
//            this.select = select;
//        }
//
//        public Map<Integer, String> getHashMap() {
//              return hashMap;
//          }
//
//          public void setHashMap(Map<Integer, String> hashMap) {
//              this.hashMap = hashMap;
//          }
//
//        public String getAnswer() {
//            return answer;
//        }
//
//        public void setAnswer(String answer) {
//            this.answer = answer;
//        }
//
//        public String getCorrect() {
//            return correct;
//        }
//
//        public void setCorrect(String correct) {
//            this.correct = correct;
//        }
//
//        public String getDetail() {
//            return detail;
//        }
//
//        public void setDetail(String detail) {
//            this.detail = detail;
//        }
//
//        public int getId() {
//            return id;
//        }
//
//        public void setId(int id) {
//            this.id = id;
//        }
//
//        public String getTitle() {
//            return title;
//        }
//
//        public void setTitle(String title) {
//            this.title = title;
//        }
//    }

}
